<div class="row">
<?php
if($id == ""){
	$div_style = ' style="display:none;"';	
}else{
	$div_style = '';	
}
?>
<script type="text/javascript" src="<?php echo W_ROOT;?>/js/action.js"></script>
<script type="text/javascript">
var selHtml = '';
jQuery(document).ready(function($){
	$("#btnsearch").click(function(){
			var txtpro_name = document.frmadd.pro_name.value;
			
			if(txtpro_name == ""){
				alert("Please input text to search!");	
				document.forms['frmadd']['pro_name'].focus();
				return false;
			}
			
			$('#imgLoading').removeClass('hide');
			//alert(txtpro_name);
			$.ajax({
				type: "GET",
				url: "process.php",
				data: "action=search_pro&searchword=" + txtpro_name,
				success: function(message){
					$('#result').html(message);
					$('#result').show();
					$('#imgLoading').addClass('hide');
					
					
					$(".addproduct").click(function(){
					  var pro_id = $(this).attr("id");
					  $('#formaddnew').hide();
					  $('#Loading').removeClass('hidel');
					  $.ajax({
						  type: "GET",
						  url: "process.php",
						  data: "action=diplayexist&id=" + pro_id,
						  success: function(message){
							  $('#result').hide();
							   
							  $('#showaddproduct').html(message);
							  $('#Loading').addClass('hidel');
							 
						  }
					  });
				  });
				}
			});
			
		});			
		
})
  </script>
<script type="text/javascript">
function checkSellerform(){
		var textdes = tinyMCE.get('txtdesc').getContent();
		var product_name = document.forms['frmadd']['new_proname'].value;
		var select_type = document.forms['frmadd']['selectType'].value;
		if(!checkeditems(document.forms['frmadd'])){	
			$("#selectCate").click();
			return false;
		}
		else if(product_name ==null || product_name==""){
			alert("Please input Product Name!");
			document.forms['frmadd']['new_proname'].focus();
			return false;
		}        
	    var selValid = true;
        
        if($(".txtprice").val() ==""){
			alert("Please input price!");
			$(".txtprice:eq("+i+")").focus();
			selValid= false;
			return false;
        }else if($(".labo:eq("+i+")").val()==""){
			alert("Please input laboratory!");
			$(".labor:eq("+i+")").focus();
			selValid= false;
			return false;
	}
        
         if($(".txtprice_reg").val() ==""){
			alert("Please input regular price!");
			$(".txtprice_reg:eq("+i+")").focus();
			selValid= false;
			return false;
        }
        
       
//         if (price_regular==null || price_regular=="") {
//            alert(" Regular price must be filled out!");
//            return false;
//        }               			
		
		if(selValid == false){
			return false;
		}else if(textdes==null || textdes==""){
			alert("Please Input Product Description!");
			$("#displaypopup").click();
			return false;
		}
		else{
			document.forms['frmadd'].submit();	
		}
}
</script>
    <div class="twelve columns">
        <form class="form-search span12" action="process.php?action=add" name="frmadd" id="frmadd" enctype= "multipart/form-data" method="post" onsubmit="return checkSellerform();">
                <?php
                    $pharmacy_id = $_SESSION['acc_id'];
                    $account = new user_account();
                    $account->getting_Id($pharmacy_id); 
                    $category = $account->category;
                    if(empty($category))
                {?>
                
                    <div class="alert alert-block fade in">
                                <button data-dismiss="alert" class="close" type="button">x</button>
                                <h3 class="alert-heading"><!--Heads up! This alert needs your attention--><?php echo $lang['HEADE_UP_ALERT'];?></h3>
                    </div>
                    <a class="btn" href="<?php echo W_ROOT;?>/company/action/?p=edit_category"><!--Add your Category First--><?php echo $lang['ADDURCATEGORYFIRST'];?></a>
        			<?php
                    } 
                    else
                    {
                    if($id==""){
             require_once(S_ROOT.'/company/product/formadd.php');
        	?>
        <style type="text/css">
        .hide{
        	display: none;
        }
        .hidel{
        	display: none;
        }
        </style>
        <?php
        }
        if($id == "")
        {
            require_once(S_ROOT.'/company/product/formadd.php');
            }
            else
            {
        
            require_once(S_ROOT.'/company/product/formedit.php');	
            }      
         }
         // end if no category
         ?>
        </form>
     </div>
</div><!--<div class="row">-->